function [anal_num, varargout] = analysis_prompt(varargin)
% ANALYSIS_PROMPT Application M-file for analysis_prompt.fig
%    FIG = ANALYSIS_PROMPT launch analysis_prompt GUI.
%    ANALYSIS_PROMPT('callback_name', ...) invoke the named callback.

% Last Modified by GUIDE v2.0 21-Aug-2003 09:47:30

global Project;
%global anal_num;

if nargin == 0  % LAUNCH GUI

	fig = openfig(mfilename,'reuse');

	% Use system color scheme for figure:
	set(fig,'Color',get(0,'defaultUicontrolBackgroundColor'));
    
    % Generate a structure of handles to pass to callbacks, and store it. 
	handles = guihandles(fig);

	%  Populate the popup menu
	num_anal = size(Project.Test_Item.Run.Channel(1).Analysis,2);
	for i=1:num_anal
        temp{i} = Project.Test_Item.Run.Channel(1).Analysis(i).Descrip;
	end
	menu_string = temp';
	set(handles.anal_num_popupmenu,'String',menu_string);
    set(handles.anal_num_popupmenu,'Value',1);

	% update_popupmenu(handles);
	% set(handles.anal_num_popupmenu,'Value',[])
 
    guidata(fig, handles);

%   Wait for callbacks to run and window to be dismissed:
    uiwait(fig);
%   After window has been dismissed set value for pass back and delete window
    handles = guidata(fig);
	anal_num = handles.anal_num;
	delete(fig);


    if nargout > 0
		varargout{1} = fig;
	end

elseif ischar(varargin{1}) % INVOKE NAMED SUBFUNCTION OR CALLBACK

	try
		if (nargout)
			[varargout{1:nargout}] = feval(varargin{:}); % FEVAL switchyard
        else
			feval(varargin{:}); % FEVAL switchyard
		end
	catch
		disp(lasterr);
	end
end
% --------------------------------------------------------------------
function varargout = anal_num_popupmenu_Callback(h, eventdata, handles, varargin)


% --------------------------------------------------------------------
function varargout = done_pushbutton_Callback(h, eventdata, handles, varargin)

handles.anal_num = get(handles.anal_num_popupmenu,'Value');
guidata(h,handles);
uiresume(handles.figure1);
